package models.ticket;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import play.db.ebean.Model;

/*
 * TicketCategory model.
 * Author: Erasyl Dabyssov
 */

@Entity
public class TicketCategory extends Model {

	@Id
	public Long id;
	
	public String name;
	
	@OneToMany(mappedBy = "category", cascade = {CascadeType.ALL})
	public List<Ticket> tickets;
	
	public static Finder<Long, TicketCategory> find = new Finder<Long, TicketCategory>(Long.class, TicketCategory.class);
	
	public static TicketCategory create(String name)
	{
		TicketCategory category = new TicketCategory();
		category.name = name;
		
		return category;
	}
}